<template>
  <div class="dashboard-container">
    <div class="content-wrapper">
      <div class="dashboard-text animated-text">您的用户名: {{ name }}</div>
      <div class="dashboard-datetime animated-text">{{ currentDate }}</div>
      <div class="dashboard-quote animated-text">{{ randomQuote }}</div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'Dashboard',
  data() {
    return {
      quotes: [
        "只有想不通的问题，没有做不成的事。",
        "成功的秘诀在于坚持自己的目标和信念。",
        "一切伟大的行动和思想，都有一个微不足道的开始。",
        "成功=艰苦努力+正确的方法+少说空话。",
      ],
    }
  },
  computed: {
    ...mapGetters([
      'name'
    ]),
    randomQuote() {
      return this.quotes[Math.floor(Math.random() * this.quotes.length)];
    },
    currentDate() {
      return new Date().toLocaleString();
    },
  },
}
</script>

<style lang="scss" scoped>
@import url('https://fonts.googleapis.com/css2?family=Lobster&display=swap');

.dashboard {
  &-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(-60deg, #ff5858 0%, #f09819 50%, #00b4db 100%);
    background-size: 600% 600%;
    animation: gradient 6s ease infinite;
  }
  .content-wrapper {
    background: rgba(0, 0, 0, 0.6);
    padding: 20px;
    border-radius: 10px;
  }
  &-text, &-datetime, &-quote {
    font-family: 'Lobster', cursive;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  }
  &-text {
    font-size: 30px;
    line-height: 46px;
  }
  &-datetime {
    font-size: 24px;
    margin-top: 20px;
  }
  &-quote {
    font-size: 20px;
    margin-top: 20px;
    text-align: center;
  }
  .animated-text {
    animation: colorchange 2s infinite;
  }
}

@keyframes gradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes colorchange {
  0% { color: white; }
  25% { color: yellow; }
  50% { color: red; }
  75% { color: blue; }
  100% { color: green; }
}
</style>
